﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<script type="text/javascript">
    function submit() {
        var oldpsw = $("#oldpsw").val();
        var newpsw1 = $("#newpsw1").val();
        var newpsw2 = $("#newpsw2").val();
        if (oldpsw.length == 0) {
            alert("请输入原密码！");
            return false;
        }
        if (newpsw1.length == 0) {
            alert("请输入新密码！");
            return false;
        }
        if (oldpsw == newpsw1) {
            alert("新旧密码不能相同！");
            return;
        }
        if (newpsw1 != newpsw2) {
            alert("密码不一致！");
            return false;
        }

        $.ajax({
            type: "POST",
            url: "/Home/DoChangePsw",
            data: { "oldpsw": oldpsw, "newpsw": newpsw1 },
            success: function(data) {
                alert(data);
            }
        });
    }

    function mailsubmit() {
//        var oldpsw = $("#mail_oldpsw").val();
        var newpsw1 = $("#mail_newpsw1").val();
        var newpsw2 = $("#mail_newpsw2").val();
//        if (oldpsw.length == 0) {
//            alert("请输入原密码！");
//            return false;
//        }
        if (newpsw1.length == 0) {
            alert("请输入新密码！");
            return false;
        }
//        if (oldpsw == newpsw1) {
//            alert("新旧密码不能相同！");
//            return;
//        }
        if (newpsw1 != newpsw2) {
            alert("密码不一致！");
            return false;
        }

        $.ajax({
            type: "POST",
            url: "/Home/DoMailChangePsw",
            data: { "oldpsw": "", "newpsw": newpsw1 },
            success: function(data) {
                alert(data);
            }
        });
    }
    
</script>

<div id="userinfo" style="padding-left: 15px; border: 1px solid gray;">
    修改系统账户密码
    <input type="submit" value="确定" onclick="return submit();" style="margin-top: 5px;" />
    <div id="changepsw" style="margin-top: 30px;">
        <div style="margin: 5px 0;">
            原密码:<input id="oldpsw" type="password" style="border: solid 1px #6C92AD; margin-left: 6px;
                width: 250px;" /></div>
        <div style="margin: 5px 0;">
            新密码:<input id="newpsw1" type="password" style="border: solid 1px #6C92AD; margin-left: 6px;
                width: 250px;" /></div>
        <div style="margin: 5px 0;">
            确&nbsp;&nbsp;&nbsp;认:<input id="newpsw2" type="password" style="border: solid 1px #6C92AD;
                margin-left: 4px; width: 250px;" /></div>
        <br />
    </div>
</div>
<br />
<div id='emailinfo' style="padding-left: 15px; border: 1px solid gray;">
    修改邮箱密码
    <input type="submit" value="确定" onclick="return mailsubmit();" style="margin-top: 5px;" />
    <div id='mail_changepsw'>
      <%--  <div style="margin: 5px 0;">
            原密码:<input id="mail_oldpsw" type="password" style="border: solid 1px #6C92AD; margin-left: 6px;
                width: 250px;" /></div>--%>
        <div style="margin: 5px 0;">
            新密码:<input id="mail_newpsw1" type="password" style="border: solid 1px #6C92AD; margin-left: 6px;
                width: 250px;" /></div>
        <div style="margin: 5px 0;">
            确&nbsp;&nbsp;&nbsp;认:<input id="mail_newpsw2" type="password" style="border: solid 1px #6C92AD;
                margin-left: 4px; width: 250px;" /></div>
        <br />
    </div>
</div>
